<?php
namespace app\common\validate;

/**
 * Class Software
 * @package app\common\validate
 * @author jwj <jwjbjg@gmail.com>
 * @copyright jwj
 */
class Software extends Validate
{
    protected $rule = [
        'id'           => ['require'],
        'name'         => ['require', 'max' => 255],
        'url'          => ['require', 'max' => 255],
        'md5'          => ['max' => 32],
        'version'      => ['max' => 32],
        'bit'          => ['require', 'in' => ['0', '32', '64']],
        'remark'       => ['max' => 255],
        'type'         => ['require', 'max' => 255],
        'latest'       => ['require', 'in' => ['0', '1']],
        'discard'      => ['require', 'in' => ['0', '1']],
        'release_date' => ['require', 'date'],
    ];

    protected $field = [
        'id'           => 'ID',
        'name'         => '名称',
        'url'          => '下载地址',
        'md5'          => 'MD5',
        'version'      => '版本号',
        'bit'          => '位数',
        'remark'       => '备注',
        'type'         => '类型',
        'latest'       => '最新',
        'discard'      => '废弃',
        'release_date' => '发布时间',
    ];

    public function sceneAdd()
    {
        return $this->remove('id', true);
    }

    public function sceneEdit()
    {
        return $this;
    }
}